/**
 * 主要用于界面弹出窗口
 * 需要注意_dialog命名冲突
 */
export default {
  data() {
    return {
      dialog: {
        title: '',
        visible: false,
        comp: null,
        width: '60%',
        height: '70%',
        props: {}
      }
    }
  },
  methods: {
    reload() {
      this.$refs.table && this.$refs.table.load()
    },
    setDialog(options) {
      options.width = options.width || '60%'
      options.height = options.height || '70%'
      options.visible = true
      this.dialog = Object.assign({}, this.dialog, options)
    },
    onDialogOk(data) {
      this.dialog.visible = false
      this.reload()
      this.$emit('dialog-ok')
    }
  }
}
